#include <stdio.h>
#include <stdlib.h>

#include <stack.h>
#define NAMESIZE 32
struct score_st
{
	int id;
	char name[NAMESIZE];
	int math;
	int chinese;
};
static void print_s(void *record)
{
	struct score_st *temp = record;
	printf("%d %s %d %d \n",temp->id,temp->name,temp->math,temp->chinese);
	return ;
}

int main(void)
{
	
	STACK *st;
	struct score_st temp;

	st = stack_create(sizeof(struct score_st));
	if(st == NULL)
		exit(1);
	int i = 0;
	for(i=0;i<7;i++)
	{	
		temp.id = i;
		snprintf(temp.name,NAMESIZE,"stu%d",i);
		temp.math = rand() % 100;
		temp.chinese = rand() % 100;
		if (stack_push(st,&temp) )
			exit(1);
	}
	int ret = 0;
	while(1)
	{
		ret = stack_pop(st,&temp);
		if (ret == -1)
			break;
		print_s(&temp);
	}
	stack_destroy(st);
	exit(0);
}
